Strategized Locking, Thread-safe Interface, and Scoped Locking Patterns and Idioms for Simplifying Multi-threaded C++ Components
نویسنده
چکیده
Developing multi-threaded applications is hard since incorrect use of locks can cause subtle and pernicious errors. Likewise, developing multi-threaded reusable components is hard since it can be time-consuming to customize components to support new, more efficient locking strategies. This paper describes a pair of patterns, Strategized Locking and Thread-safe Interface, and a C++ idiom, Scoped Locking, that help developers avoid common problems when programming multi-threaded components and applications.
منابع مشابه
Patterns for Reducing Locking Overhead in Multi-threaded Programs
In theory, multi-threading an application can improve performance since multiple instruction streams can be executed simultaneously. In practice, multi-threaded applications often perform no better, or even worse, than single-threaded applications due to the overhead of acquiring and releasing locks [1]. This paper describes several patterns that minimize locking overhead in multi-threaded prog...
متن کاملScoped Locking 1 Scoped Locking
Example Commercial Web servers typically maintain a ‘hit count’ component that records how many times each URL is accessed by clients over a period of time. To reduce latency, a Web server process does not maintain the hit counts in a file on disk but rather in a memoryresident table. Moreover, to increase throughput, Web server processes are often multi-threaded [HS98]. Therefore, public metho...
متن کاملA Basis for Verifying Multi-threaded Programs
Advanced multi-threaded programs apply concurrency concepts in sophisticated ways. For instance, they use fine-grained locking to increase parallelism and change locking orders dynamically when data structures are being reorganized. This paper presents a sound and modular verification methodology that can handle advanced concurrency patterns in multi-threaded, object-based programs. The methodo...
متن کاملDouble-Checked Locking An Optimization Pattern for Efficiently Initializing and Accessing Thread-safe Objects
This paper shows how the canonical implementation [1] of the Singleton pattern does not work correctly in the presence of preemptive multi-tasking or true parallelism. To solve this problem, we present the Double-Checked Locking optimization pattern. This pattern is useful for reducing contention and synchronization overhead whenever “critical sections” of code should be executed just once. In ...
متن کاملDouble-Checked Locking An Object Behavioral Pattern for Initializing and Accessing Thread-safe Objects Efficiently
This paper shows how the canonical implementation [1] of the Singleton pattern does not work correctly in the presence of preemptive multi-tasking or true parallelism. To solve this problem, we present the Double-Checked Locking pattern. This pattern is useful for reducing contention and synchronization overhead whenever “critical sections” of code rarely need to acquire locks. In addition, the...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1999